package day017.stream;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;

public class StreamDemo2 {
    public static void main(String[] args) {
        method1();
        method2();
        method3();
    }

    private static void method3() {
        int[] arr = {1, 2, 3, 4, 5, 6};
        Arrays.stream(arr).forEach(s -> System.out.println(s));
    }

    private static void method2() {
        HashMap<String, String> hm = new HashMap<>();
        hm.put("it001", "曹植");
        hm.put("it002", "曹丕");
        hm.put("it003", "曹熊");
        hm.put("it004", "曹冲");
        hm.put("it005", "曹昂");

        hm.keySet().stream().forEach(s -> System.out.println(s));
        hm.entrySet().stream().forEach(s -> System.out.println(s));
    }

    private static void method1() {
        ArrayList<String> list = new ArrayList<>();
        list.add("迪丽热巴");
        list.add("古力娜扎");
        list.add("马尔扎哈");
        list.add("欧阳娜娜");
        list.stream().forEach(s -> System.out.println(s));
    }
}
